<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

</body>
<script>

    const obj = {
        id: 1,
        name: 'andy',
        // 在es6里面，对象定义方法的时候，可以省略 : function
        /*  say1: function () {
             console.log(`${this.name} is ${this.id} years old`);
         }, */

        say() {
            console.log(`${this.name} is ${this.id} years old`);
        }
    }

    console.log(obj);
    obj.say();



</script>

</html>